Breadcrumb · Bootstrap v5.2 您所在的位置:网站首页 bootstrap aria-current Breadcrumb · Bootstrap v5.2

Breadcrumb · Bootstrap v5.2

#Breadcrumb · Bootstrap v5.2| 来源: 网络整理| 查看: 265

View on GitHub Breadcrumb

Indicate the current page’s location within a navigational hierarchy that automatically adds separators via CSS.

On this page Example

Use an ordered or unordered list with linked list items to create a minimally styled breadcrumb. Use our utilities to add additional styles as desired.

html Home Home Library Home Library Data Dividers

Dividers are automatically added in CSS through ::before and content. They can be changed by modifying a local CSS custom property --bs-breadcrumb-divider, or through the $breadcrumb-divider Sass variable — and $breadcrumb-divider-flipped for its RTL counterpart, if needed. We default to our Sass variable, which is set as a fallback to the custom property. This way, you get a global divider that you can override without recompiling CSS at any time.

html Home Library

When modifying via Sass, the quote function is required to generate the quotes around a string. For example, using > as the divider, you can use this:

$breadcrumb-divider: quote(">");

It’s also possible to use an embedded SVG icon. Apply it via our CSS custom property, or use the Sass variable.

Using embedded SVG

Inlining SVG as data URI requires to URL escape a few characters, most notably and #. That’s why the $breadcrumb-divider variable is passed through our escape-svg() Sass function. When using the CSS custom property, you need to URL escape your SVG on your own. Read Kevin Weber’s explanations on CodePen for detailed information on what to escape.

html Home Library $breadcrumb-divider: url("data:image/svg+xml,");

You can also remove the divider setting --bs-breadcrumb-divider: ''; (empty strings in CSS custom properties counts as a value), or setting the Sass variable to $breadcrumb-divider: none;.

html Home Library $breadcrumb-divider: none; Accessibility

Since breadcrumbs provide a navigation, it’s a good idea to add a meaningful label such as aria-label="breadcrumb" to describe the type of navigation provided in the element, as well as applying an aria-current="page" to the last item of the set to indicate that it represents the current page.

For more information, see the ARIA Authoring Practices Guide breadcrumb pattern.

CSS Variables Added in v5.2.0

As part of Bootstrap’s evolving CSS variables approach, breadcrumbs now use local CSS variables on .breadcrumb for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

--#{$prefix}breadcrumb-padding-x: #{$breadcrumb-padding-x}; --#{$prefix}breadcrumb-padding-y: #{$breadcrumb-padding-y}; --#{$prefix}breadcrumb-margin-bottom: #{$breadcrumb-margin-bottom}; @include rfs($breadcrumb-font-size, --#{$prefix}breadcrumb-font-size); --#{$prefix}breadcrumb-bg: #{$breadcrumb-bg}; --#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius}; --#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color}; --#{$prefix}breadcrumb-item-padding-x: #{$breadcrumb-item-padding-x}; --#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-active-color}; Sass variables $breadcrumb-font-size: null; $breadcrumb-padding-y: 0; $breadcrumb-padding-x: 0; $breadcrumb-item-padding-x: .5rem; $breadcrumb-margin-bottom: 1rem; $breadcrumb-bg: null; $breadcrumb-divider-color: $gray-600; $breadcrumb-active-color: $gray-600; $breadcrumb-divider: quote("/"); $breadcrumb-divider-flipped: $breadcrumb-divider; $breadcrumb-border-radius: null;


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有